// Dom7
var $$ = Dom7;

// Framework7 App main instance
var app = new Framework7({
	root: '#app', // App root element
	id: 'io.yachtar.app', // App bundle ID
  	name: 'Yachtar', // App name
	theme: 'auto', // Automatic theme detection
	dialog: {
		// set default title for all dialog shortcuts
		title: '提示',
		// change default "OK" button text
		buttonOk: '确认',
	  }
});

// Init/Create main view
var mainView = app.views.create('.view', {
	url: '/'
});

$(document).ready(function() {
	call_remote(REQUEST_TYPE814,{flowid:6000,stepid:stepid},function(data){
		if(data.length>0){
			for (var i = 0; i < data.length; i++) {
				var elem_li = document.createElement('li');
				elem_li.setAttribute("class", "li-list");
				elem_li.setAttribute("onclick","votedetail('" + data[i].serialno + "','"+ data[i].givetype +"')");
				var elem_div = document.createElement("div");
				elem_div.setAttribute("class", "imgdiv");
				var elem_p = document.createElement("p");
				elem_p.setAttribute("class", "p-list");
				elem_p.innerHTML = data[i].villageid_chs +"-"+data[i].description;
				document.getElementById('ul-list').appendChild(elem_li); 
				elem_li.appendChild(elem_div);
				elem_div.appendChild(elem_p);
			}
		}else{
			var elem_li = document.createElement('li');
			elem_li.setAttribute("class", "li-list");
			elem_li.innerHTML ="无表决项目";
			elem_li.appendChild(elem_li);
		}
	});
});

//返回
$$('#backimg').on('click', function () {
	window.location.href = "../../index.html";
});

function votedetail(serialno,givetype){
	sessionStorage.setItem("serialno",serialno);
	sessionStorage.setItem("givetype",givetype);
	window.location.href = "../../plugin/vote/votedetail.html";
}